{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "p = Path(r'D:\\文档\\重点供应商年审\\重点供应商年审\\欧泊&友邦')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "title = '<table>\\n'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "title_2 = '<td><img src=\"file:///'\n",
    "last_2 = '\" width=160 height=120 /></td></tr>\\n'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "last = '</table>\\n'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "l = [i for i in p.glob('**/*.jpg') if i.is_file()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(r'd:\\欧泊.txt', 'w') as f:\n",
    "    f.write(title)\n",
    "    for i in l:\n",
    "        f.write('<tr>\\n<td>'+str(i.parent)+'</td>\\n')\n",
    "        f.write('<td>'+i.name[:-4]+'</td>\\n')\n",
    "        f.write('<td>'+time.strftime('%Y-%m-%d', time.localtime(i.stat()[-1]))+'</td>\\n')\n",
    "        f.write(title_2+str(i)+last_2)\n",
    "    f.write(last)\n",
    "print('all is ok!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
